﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HowMuchTimeFromStart
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.WriteLine("Insert year from 1900 to 2100");
			int Y = int.Parse(Console.ReadLine());
			int[] arrayM = new int[12];
			arrayM[0] = 31;
			arrayM[2] = 31;
			arrayM[3] = 30;
			arrayM[4] = 31;
			arrayM[5] = 30;
			arrayM[6] = 31;
			arrayM[7] = 31;
			arrayM[8] = 30;
			arrayM[9] = 31;
			arrayM[10] = 30;
			arrayM[11] = 31;
			if (Y % 4 != 0 || Y % 100 == 0 && Y % 400 != 0)
			{
				Console.WriteLine("Year is not a leap. Please input a month in format from 1 to 12.");
				arrayM[1] = 28;

			}
			else
			{
				Console.WriteLine("Year is a leap. Please input a month in format from 1 to 12. ");

				arrayM[1] = 29;
				
			}
			int Peremennaya = int.Parse(Console.ReadLine());
			int s = 0;
			for (int i = 0; i < Peremennaya - 1; i++)
			{
				s += arrayM[i];
			}
			Console.WriteLine(s);
			Console.WriteLine("Input a day according to selected month.");
			int Day = int.Parse(Console.ReadLine());
			s = s + Day;
			Console.WriteLine(s);
			Console.ReadLine();
		}
	}
}